package com.zw.yzk.kabu.data.repository;

import com.zw.yzk.kabu.data.network.ServiceGenerator;
import com.zw.yzk.kabu.data.network.entity.ImTokenEntity;
import com.zw.yzk.kabu.data.network.service.GetImTokenService;
import com.zw.yzk.kabu.data.network.task.Task;

import javax.inject.Inject;

import rx.Observable;
import rx.functions.Func1;

/**
 * Created by zhanwei on 2016/12/24.
 */

public class GetImTokenRepository extends CommonRepository {

    @Inject
    public GetImTokenRepository() {

    }

    @Override
    protected Observable connectServer(Task task) {
        GetImTokenService service = ServiceGenerator.createService(GetImTokenService.class);

        return service.getVerifyCode(task.userId, task.accessToken);
    }

    @Override
    protected Func1<ImTokenEntity, Observable> getServerData() {
        return new Func1<ImTokenEntity, Observable>() {
            @Override
            public Observable call(ImTokenEntity entity) {
                return Observable.just(entity);
            }
        };
    }

}
